- content_for :title_header do
  %h1
    = t("layouts.admin.admin")
    = "-"
    = t("admin.listing_shapes.index.listing_shapes")

- content_for :javascript do
  window.ST.initializeListingShapesOrder();



= render partial: 'layouts/onboarding_popup_wrapper'
= render partial: "admin/left_hand_navigation", locals: { links: admin_links_for(@current_community), selected_left_navi_link: selected_left_navi_link }

.left-navi-section
  .row
    .col-12
      %h2= t(".listing_shapes")
      %p= t(".description")

      - if display_knowledge_base_articles
        %p
          = link_to t(".read_more_about_order_types"), "#{knowledge_base_url}/configuration-and-how-to/how-order-types-listing-types-and-pricing-units-work", target: :_blank

  .row
    .col-5
      %strong
        = t(".header.listing_shape_name")
    .col-5
      %strong
        = t(".header.listing_shape_categories")
    .col-2
  - sort_disabled_class = listing_shapes.size == 1 ? "disabled" : ""
  - listing_shapes.map do |shape|
    .row.js-listing-shape-row{data: {id: shape.id}}
      .col-5
        = t(shape.name_tr_key)
      .col-5
        - if shape.category_ids.size == 0
          = t("admin.listing_shapes.index.no_categories")
        - elsif shape.category_ids.size == category_count
          = t("admin.listing_shapes.index.all_categories")
        - else
          = t("admin.listing_shapes.index.category_count", :category_count => "#{shape.category_ids.size}/#{category_count}")
      .col-2
        = link_to edit_admin_listing_shape_path(shape.name) do
          = icon_tag("edit", ["icon-fix"])
        = link_to '#', :class => "js-listing-shape-action-up admin-sort-button #{sort_disabled_class}", :tabindex => "-1" do
          = icon_tag("directup", ["icon-fix"])
        = link_to '#', :class => "js-listing-shape-action-down admin-sort-button #{sort_disabled_class}", :tabindex => "-1" do
          = icon_tag("directdown", ["icon-fix"])

  #listing-shape-ajax-status
    .ajax-notification.ajax-notice.listing-shape-ajax-status-message.js-listing-shape-ajax-saving
      .ajax-icon{:class => icon_class("loading")}
      .ajax-text
        = t("admin.listing_shapes.index.order.saving_order")
    .ajax-notification.ajax-success.listing-shape-ajax-status-message.js-listing-shape-ajax-success
      .ajax-icon{:class => icon_class("check")}
      .ajax-text
        = t("admin.listing_shapes.index.order.save_order_successful")
    .ajax-notification.ajax-error.listing-shape-ajax-status-message.js-listing-shape-ajax-error
      = t("admin.listing_shapes.index.order.save_order_error")

  .row
    .col-12
      = form_tag new_admin_listing_shape_path, method: :get do
        .new-listing-shape-template-form-column
          = t("admin.listing_shapes.index.add_new_shape")
        .new-listing-shape-template-form-column
          = select_tag :template, options_for_select([[t("admin.listing_shapes.index.select_template"), nil]].concat(templates.map { |(label_tr_key, template_name)| [t(label_tr_key), template_name]})), onChange: "form.submit();"
